<?php $this->headLink()->appendStylesheet($this->baseUrl() . '/css/catalog.css') ?>
<?php
$isAddMode = false;
$imageRouting = 'image';
$token = null;
if (isset($this->addMode) && $this->addMode) {
    $isAddMode = true;
    $token = $this->token;
}
?>
<div class="catalog span12">
    <div class="clearfix breadcrumb-categories">
        <a href="<?= $this->url(array('controller' => 'catalog', 'action' => 'index', 'id' => $this->entry['parent_category_code'], 'name' => $this->entry['parent_category_name']), 'default', true) ?>"><?= $this->entry['parent_category_name'] ?></a>
        <i class="icon-chevron-right"></i> 
        <a href="<?= $this->url(array('controller' => 'catalog', 'action' => 'index', 'id' => $this->entry['category_code'], 'name' => $this->entry['category_name']), 'default', true) ?>"><?= $this->entry['category_name'] ?></a>
    </div>
    <div class="navbar">
        <div class="navbar-inner">
            <?php if(isset($this->entry['creation_date'])): ?>
            <div class="item_date" title="Data dodania wpisu do katalogu firm i instytucji"><?php $tmp = explode(' ', $this->entry['creation_date']); echo $tmp[0]; ?></div>
            <?php endif; ?>
            <h3 class="title"><?= $this->escape($this->entry['title']) ?></h3>
        </div>
    </div>
    <div class="clearfix">
        <?php if (!empty($this->entry['image_code'])): ?>
            <div class="thumbnails pull-right thumb-prev">
                <a class="thumbnail imagePreview" href="<?= $this->url(array('id' => $this->entry['image_code'], 'width' => 800, 'height' => 800, 'token' => $token), $imageRouting, true) ?>">
                    <img src="<?= $this->url(array('id' => $this->entry['image_code'], 'width' => 200, 'height' => 200, 'token' => $token), $imageRouting, true) ?>" alt="" />
                </a>
            </div>
        <?php endif ?>
        <?php if ($this->entry['type'] == Application_Model_DAO_Catalog::TYPE_PAID && !empty($this->entry['description'])): ?>
            <div class="body"><?= nl2br($this->entry['description']) ?></div>
        <?php endif ?>
    </div>
    <fieldset>
        <legend><?= $this->translate('XXX_CATALOG_SHOW_INFO') ?></legend>

        <div class="row-fluid catalog_attributes">
            <div class="span3 attr_name"><?= $this->translate('XXX_CATALOG_SHOW_INFO_CITY_TEXT') ?></div>
            <div class="span3 attr_value">
                <?= $this->entry['address'] ?><br/>
                <?= $this->entry['zip_code'] ?> <?= $this->entry['city'] ?>
            </div>
        </div>
        <div class="row-fluid catalog_attributes">
            <div class="span3 attr_name"><?= $this->translate('XXX_CATALOG_SHOW_INFO_PHONE_TEXT') ?></div>
            <div class="span3 attr_value">
                <?= $this->entry['phone'] ?>
            </div>            
        </div>
        <?php if ($this->entry['type'] == Application_Model_DAO_Catalog::TYPE_PAID): ?>
            <div class="row-fluid catalog_attributes">
                <div class="span3 attr_name"><?= $this->translate('XXX_CATALOG_SHOW_INFO_EMAIL_TEXT') ?></div>
                <div class="span3 attr_value">
                    <?php if (!empty($this->entry['email'])): ?>
                        <a href="mailto:<?= $this->entry['email'] ?>?subject=Wiadomość z portalu Toruńonline.info"><?= $this->entry['email'] ?></a>
                    <?php endif ?>
                </div>
                <div class="span3 attr_name"><?= $this->translate('XXX_CATALOG_SHOW_INFO_WEB_TEXT') ?></div>
                <div class="span3 attr_value">
                    <?php
                    $url = trim($this->entry['web']);
                    if (!empty($url) && stripos($url, 'http:') === false) {
                        $url = 'http://' . $url;
                    }
                    ?>
                    <a href="/redirect?url=<?= urlencode($url) ?>"><?= $this->entry['web'] ?></a>
                </div>
            </div>
        <?php endif ?>
    </fieldset>
     <?php if (isset($this->similars) && !empty($this->similars)): ?>
        <div class="similars">
            <div class="title"> Podobne wpisy z tej kategorii: </div>
            <div class="">
                <?php foreach ($this->similars as $i => $entry): ?>
                    <?php
                    $url = $this->url(array('controller' => 'catalog', 'action' => 'show', 'id' => $entry['code'], 'title' => $entry['title']), 'default', true);
                    ?>
                <div class="row-fluid">
                    <div class="span2">
                        <a class="img_prev" style="background-image: url(<?= $this->url(array('id' => empty($entry['img_id']) ? 0 : $entry['img_id'], 'width' => 110, 'height' => 45), 'image', true) ?>);" href="<?= $url ?>">&nbsp;</a>
                    </div>
                    <div class="span10">
                        <a href="<?= $url ?>"><?= $this->escape($entry['title']) ?></a>
                    </div>
                </div>
                <?php endforeach ?>
            </div>
        </div>
    <?php endif; ?>
</div>